﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ProductDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] != null)
        {
            loginuser.Text = Session["user"].ToString();
        }
        else
        {
            loginuser.Text = "Please login to continue shopping   !!";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        #region Insert To Cart

        try
        {
            if (Session["cart"] != null)
            {
                Shopping_Cart cart = (Shopping_Cart)Session["cart"];

                Label Pr_ID = (Label)DataList1.Controls[0].FindControl("Pro_IDLabel");
                Label Code = (Label)DataList1.Controls[0].FindControl("CodeLabel");
                Label Pr_Name = (Label)DataList1.Controls[0].FindControl("Pro_NameLabel");
                Label Pr_Price = (Label)DataList1.Controls[0].FindControl("Pro_PriceLabel");
                Label Po_Value = (Label)DataList1.Controls[0].FindControl("Point_ValueLabel");
                Label Bu_value = (Label)DataList1.Controls[0].FindControl("lbl_Bv");
                Image Im = (Image)DataList1.Controls[0].FindControl("Image1");
                TextBox Qun_Tb = (TextBox)DataList1.Controls[0].FindControl("TextBox3");

                cart.insertItems(Pr_ID.Text, Code.Text, Pr_Name.Text, double.Parse(Pr_Price.Text), float.Parse(Po_Value.Text), float.Parse(Bu_value.Text), int.Parse(Qun_Tb.Text), Im.ImageUrl);


            }
        }
        catch (Exception) { Response.Redirect("404.aspx"); }
        #endregion
    }
}